package com.huxi.http;

import static org.apache.commons.lang3.StringUtils.isEmpty;

import java.util.Collections;
import java.util.Set;

public class HttpUrlException extends HttpCallException {

	private static final long serialVersionUID = 1L;

	private Set<String> keys;

	public HttpUrlException() {
		this(null, null);
	}

	public HttpUrlException(String url, Set<String> keys) {
		super(isEmpty(url) ? "HTTP访问URL不能未空" : "HTTP访问URL地址无效 - " + url);
		super.withUrl(url);
		this.keys = keys;
	}

	public Set<String> getIllegalKeys() {
		if (keys == null) {
			return Collections.emptySet();
		} else {
			return Collections.unmodifiableSet(keys);
		}
	}

}
